#!/usr/bin/env python
# -*- coding:utf-8 -*-

from selenium import webdriver
from selenium.webdriver.common.keys import Keys

# 如果显示当面selenium版本不支持phantomjs，则selenium版本选择2.48.0
# phantomjs的下载与配置见印象笔记
driver = webdriver.PhantomJS()
driver.get("http://www.baidu.com/")

# 源码
# print(driver.page_source)

# cookie
print(driver.get_cookies())

# 输入文字
driver.find_element_by_id("kw").send_keys(u"美女")

# 点击按钮
# driver.find_element_by_id("su").click()

# 回车
# driver.find_element_by_id("su").send_keys(Keys.RETURN)

# driver.save_screenshot("美女.png")
print("完成")

